<!DOCTYPE html>
<html>
	<head>
		<title>HTML5 Drag-and-Drop handling</title>
		<link rel="stylesheet" href="../../codebase/webix.css" type="text/css" charset="utf-8">
		<script src="../../codebase/webix.js" type="text/javascript" charset="utf-8"></script>

		<link rel="stylesheet" type="text/css" href="../common/samples.css">
		<script src="../common/testdata.js" type="text/javascript" charset="utf-8"></script>
	</head>
	<body class='webix_full_screen'>
		<div class='sample_comment'>Drag one of Marked divs into the Webix view</div>
		<div id="testA" style='width:500px;'></div>
		
		<div style='padding:20px;'>
		<div id="divA" style='float:left; padding:20px; background-color:#dff;' draggable="true" ondragstart="drag(event)" > A </div>
		<div id="divB" style='float:left; padding:20px; background-color:#fdf;' draggable="true" ondragstart="drag(event)" > B </div>
		<div id="divC" style='float:left; padding:20px; background-color:#ffd;' draggable="true" ondragstart="drag(event)" > C </div>
		</div>
		<script type="text/javascript" charset="utf-8">
		function drag(ev){
			ev.dataTransfer.setData("title",ev.target.innerHTML);
		}
		

		webix.ready(function(){
			var grid = {
				view:"datatable", id:"mygrid",
				container:"testA",
				columns:[
					{ id:"rank",	header:"#", 		width:50 },
					{ id:"title",	header:"Film title",width:200,  fillspace:true},
					{ id:"votes",	header:"Votes", 	width:100 },
					{ id:"year",	header:"Released" , width:80 }
					
				],
				select:"multiselect",
				drag:true, scrollX:false,

				autoheight:true,
				data:small_film_set
			};

			var mygrid = webix.ui( grid );
			webix.event(mygrid.$view, "dragover", function(e){ e.preventDefault(); });
			webix.event(mygrid.$view, "drop", function(e){ 
				var grid = $$(e);
				var id = grid.locate(e);
				grid.getItem(id).title = e.dataTransfer.getData("title");
				grid.refresh(id);
			});
		});



		</script>
	</body>
</html>